<h1>Nuova assistenza per <%= @assistance.client.name_or_society %></h1>
<%= error_messages_for :assistance %>

<% form_for(@assistance) do |f| %>
  <div id="campi">
		<div id="notes">
			<p><label for="assistance_notes">Note: </label><br />
			<%= f.text_area :notes, :size => "30x14" %></p>
		</div>
  	<p><label for="assistance_operator_id">Operatore: </label><br />
  	<%= collection_select(:assistance, :operator_id, Operator.find(:all), 
												:id, :login, :prompt => "Seleziona Operatore") %></p>
		<p><label for="assistance_typology">Tipo: </label><br />
			<%= f.select(:typology, [ "app", "lab", "help" ], :include_blank => "seleziona" ) %>
			<label for="globe">Globe</label>
			<input id="globe" name="globe" type="checkbox" checked="checked" />
		</p>
		<p><label for="assistance_short_desc">Descrizione breve: </label><br /><%= f.text_field :short_desc %></p>
															
    <input type="hidden" id="assistance_client_id" name="assistance[client_id]" value="<%= @assistance.client_id %>" />
		
    <p><label for="assistance_urgency">Tassativa</label><%= f.check_box :urgency %></p>
    <p><label for="assistance_ticket_state">Stato ticket: </label><br />
    <select name="assistance[ticket_state]">
      <option value="0">Non completato</option>
      <option value="1">Completato Parz.</option>
      <option value="2">Completato</option>
    </select></p>
    <p><label for="assistance_expiration">Scadenza: </label><br />
		<%= calendar_date_select_tag "assistance[expiration]", Time.now, :time => true %></p>
		<p><label for="assistance_token">Valore: </label><br /><%= f.text_field :token, :size => 5 %></p>
    <p><label for="assistance_duration">Durata intervento: </label><br />
    <%= time_select 'assistance', 'duration', :minute_step => 15, :time_separator => ':' %></p>

		<%= render :partial => 'operations' %>
		<br /><br />
    <%= f.submit "Crea" %>
  </div>
<% end %>

<br />
<%= link_to 'Back', :back %>

<div id="add_operation" style="display:none">
	<% form_remote_tag :url => {:controller => 'operations', :action => 'create'}, 
	    :html => {:id => 'operation_form'} do %>
		<p><label for="operation_description">Descrizione: </label><br /><input id="operation_description" name="operation[description]" size="30" type="text" /></p>
		<br />
    <input id="operation_submit" name="commit" type="submit" value="Crea operazione" />
	<% end %>
</div>